<!DOCTYPE html>
<html lang="en">
<style>
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
    input[type=checkbox], input[type=radio] {
        display: inline-block;
    }
</style>
<link href="/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<!-- 图片上传 -->
<!--引入CSS-->
<link rel="stylesheet" type="text/css" href="/static/webuploader/webuploader.css">
{include file="Public/head"}

<body data-type="widgets">
<!--<script src="/daterangepicker/jquery-3.2.1.min.js" type="text/javascript"></script>-->
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

    {include file='Public:header'}
    {include file='Public:menu2'}



    <!-- 内容区域 -->
    <div class="tpl-content-wrapper" >
        <div class="row-content am-cf">
            <div class="row">

                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title am-fl">增加专题</div>
                            <div class="widget-function am-fr">
                                <a href="javascript:;" class="am-icon-cog"></a>
                            </div>
                        </div>
                        <div class="widget-body am-fr">
                            <form id="roleform"  form="submit" class="am-form tpl-form-border-form tpl-form-border-br">
                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">专题标题 </label>
                                    <div class="am-u-sm-9">
                                        <input type="text" class="tpl-form-input" name="topic_title" id="topic_title" placeholder="标题不能超过24个字">
                                        <small></small>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">专题封面 </label>
                                    <div class="am-u-sm-9">
                                        <input type="hidden" name="topic_image" value="" id="topic_image">
                                        <img src="/static/images/no_image.jpg" width="200" style="border:1pt solid #F6F6F6;">
                                        <div id="uploader1"  style="position: absolute;top:0px;left:220px;">
                                            <span id="filepicker1"class="btn">选择图片</span>
                                            <div class="uploader-list"></div>
                                        </div>
                                    </div>
                                </div>


                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">内容块距顶部</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" class="tpl-form-input" name="topic_margin_top" id="topic_margin_top" placeholder="像素">
                                        <small></small>
                                    </div>
                                 </div>

                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">专题内容</label>
                                    <div class="am-u-sm-9">
                                        <textarea class="span12 ckeditor" name="topic_content" title="" style=" width:900px; height:500px;"></textarea>
                                        <small></small>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <div class="am-u-sm-9 am-u-sm-push-3">
                                        <a onclick="javascript:history.back(-1);" ><div class="btn btn-default" type="reset" >返回</div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                                        <input class="btn btn-info"  type="button" onclick="adsubmit(1)" value="保存草稿">
                                        <input class="btn btn-info"  type="button" onclick="adsubmit(2)" value="发布专题">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

</body>
{include file='Public:script'}
{include file='Public:validation'}
<!--图片引入JS-->
<script type="text/javascript" src="/static/webuploader/webuploader.js"></script>
<script type="text/javascript" src="/static/webuploader/webuploader.min.js"></script>
<script type="text/javascript" src="/static/js/uploader.js"></script>
<script>

    //提交
    function adsubmit(esv){
        var param = new Object();
        $("input").each(function(k, v){
            v = $(v);
            param[v.attr("id")] = v.val();
        });
        param['topic_content']=$('.ckeditor').val();
        param['topic_state']=esv;
        $.post(
            "{:url('add')}",
             param,
             function(ret){
            if(ret.code != 200){
                layer.msg(ret.msg, {icon: 2});
                return false;
            }
            layer.msg(ret.msg, {icon: 1,time:2000},function(){
                location.href = "{:url('topic_List')}";
            });
        });
    }
    //图片上传
    var uploader1;
    var arr1 = {
        'container':'#uploader1',
        'pick':'#filepicker1',
        'server':"{:url('webuploader')}",
        successHandler:function(file,response){
            var $input = $("input[name=topic_image]");
            $input.val(response.filename);
            $input.siblings("img").attr("src",response.link);
        }
    };

    if(!uploader1){
        uploader1 = getUploader(arr1);
    }

</script>

</html>